package com.example.data0306.news;

import android.os.Bundle;
import android.view.View;

import androidx.viewpager.widget.ViewPager;

import com.example.data0306.Adapter.NewTopAdapter;
import com.example.data0306.R;
import com.example.data0306.base.BaseFragment;
import com.example.data0306.bean.NewsTypeBean;
import com.google.android.material.tabs.TabLayout;

public class NewTopFragment extends BaseFragment {

    public static Bundle newArgument(String title) {
        Bundle args = new Bundle();
        args.putString("title", title);
        return args;
    }

    private TabLayout nTabLayout;
    private ViewPager nViewPager;
    private NewTopAdapter nTopAdapter;

    @Override
    protected void initArgumentData(Bundle arguments) {
        super.initArgumentData(arguments);
    }

    @Override
    protected int rootLayout() {
        return R.layout.fragment_hometop_news;
    }

    @Override
    protected void initView(View rootView) {
        nTabLayout = rootView.findViewById(R.id.tab_homenews_top);
        nViewPager = rootView.findViewById(R.id.home_content);
    }

    @Override
    protected void initData() {
        nTopAdapter = new NewTopAdapter(getChildFragmentManager());
        nViewPager.setAdapter(nTopAdapter);
        nTabLayout.setupWithViewPager(nViewPager);
        nTabLayout.setInlineLabel(true);
    }

    @Override
    protected int contentView() {
        return 0;
    }

    @Override
    protected void bindData() {
        super.bindData();
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"关注"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"推荐"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"手游"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_YUNDING,"云顶"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_SAISHI,"赛事"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"视屏"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"电视台"));
        nTopAdapter.addData(new NewsTypeBean(NewsTypeBean.TYPE_ARTICLE,"活动"));

    }

    @Override
    protected void bindEvent() {

    }
}
